import { Injectable } from '@nestjs/common';
import { JwtService } from '@nestjs/jwt';

@Injectable()
export class AuthService {
	constructor(
		private readonly jwtService: JwtService
	) {}

	async login(user: any) {
		const payload = { name: user.name, sub: user._id };
		return {
			token: this.jwtService.sign(payload),
		};
	}
}
